package com.qfedu.knowledge.entity.vo;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @ClassName PageResult
 * 分页结果
 * @Author ykx
 * @Date 2024/1/4 10:14
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> {
    /**
     * 总记录数
     */
    private Long total;

    /**
     * 总页数
     */
    private Integer pages;

    /**
     * 数据记录列表
     */
    private List<T> records;

    public PageResult(PageInfo<T> pageInfo) {
        this.total = pageInfo.getTotal();
        this.pages = pageInfo.getPages();
        this.records = pageInfo.getList();
    }

}
